package com.joysuch.wwyt.datadump.biz.condition;

import cn.zlg.common.datadump.condition.CustomQueryConditionBuilder;
import com.joysuch.wwyt.bp.entity.BpDepart;
import com.joysuch.wwyt.bp.entity.dsl.QBpDepart;
import com.joysuch.wwyt.bp.repository.BpDepartDao;
import com.joysuch.wwyt.bp.service.impl.BpDepartServiceImpl;
import com.joysuch.wwyt.core.entity.dsl.QBaseUser;
import com.joysuch.wwyt.core.service.BaseUserService;
import com.joysuch.wwyt.core.support.Context;
import com.querydsl.core.types.ExpressionUtils;
import com.querydsl.core.types.Predicate;
import com.querydsl.core.types.dsl.SimpleExpression;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Optional;

@Component
public class BpDepartDumpFindSubdepartConditionBuilder implements CustomQueryConditionBuilder {

    @Autowired
    private BpDepartDao dao;

    @Override
    public Predicate build(String name, SimpleExpression propertyPath, Object value) {
        Long id = (Long) value;
        return BpDepartServiceImpl.buildSearchSubdepartCondition(id, null, QBpDepart.bpDepart1, dao);
    }


}
